package main

import "fmt"

var merged string

// 比较string长度，获取最小值
func StringMin(s1 string, s2 string) int {
   if len(s1) > len(s2) {
      return len(s2)
   } else {
      return len(s1)
   }
}

func AddStr(s1 string, s2 string) string {

   // 获取长度最小值
   StringMinLen := StringMin(s1, s2)

   // 字符串长度重合的部分，按顺序添加
   for i := 0; i < StringMinLen; i++ {
      merged = merged + string(s1[i])

      merged = merged + string(s2[i])
   }

   // 字符串长度不重合的部分，需要追加在后面
   if len(s1) > len(s2) {
      merged = merged + string(s1[StringMinLen:])
   } else if len(s1) < len(s2) {
      merged = merged + string(s2[StringMinLen:])
   }

   return merged

}

func main() {

   fmt.Println(AddStr("abcd", "xy"))
}